<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/staticfile/css/bootstrap.css"/>
    <link rel="shortcut icon" href="${pageContext.request.contextPath }/staticfile/img/yinhang.png">
    <title>${accountName } -- 欢迎你</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/staticfile/css/index.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath }/layui/css/layui.css"  media="all">
</head>
<style type="text/css">
    body {
        height:auto;
        background:url("${pageContext.request.contextPath }/uploadImage/fghy.jpeg") no-repeat center fixed;
        -webkit-background-size:cover;
        -moz-background-size:cover;
        -o-background-size:cover;
        background-size:cover;
    }
    canvas#live2dcanvas {
        border: 0 !important;
        left: 0;
    }

    .form {
        width: 1200px;
        height: 800px;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        background: rgba(217, 187, 226, 0);
        border-radius: 4px;
        box-shadow: 5px 5px 20px #444444;
    }

    .input-group {
        padding: 0 10px;
        font-size: 18px;
        border-radius: 6px;
        padding-top: 10px;
    }

    #canvas {
        float: right;
        display: inline-block;
        border: 1px solid #ccc;
        border-radius: 5px;
        cursor: pointer;
    }

    /* #1abc9c */
    .length {
        width: 105px;
    }

    .top {
        width: 100%;
    }

    .ntop {
        width: 100%;
        background-color: #1abc9c;
        color: #e6e6e6;
    }

    .btn:hover .img {
        src: url(${pageContext.request.contextPath }/staticfile/img/pig2.png);

    }
    video {
        position: fixed;
        right: 0px;
        bottom: 0px;
        min-width: 100%;
        min-height: 100%;
        height: auto;
        width: auto;
    }

    source {
        min-width: 100%;
        min-height: 100%;
        height: auto;
        width: auto;
    }

</style>
<body>

<div class="form">
    <div class="navbar-header ntop">
        <div class="btn btn-block btn-lg top"><b>
						<span id="img"><img src="${pageContext.request.contextPath }/staticfile/img/piglogo.png"
                                            style="width: 16%;margin-top: -9px;float: left;"/>
						</span>
            <i><marquee direction="left" style="width: 55%">最新公告：<strong id="affiche" ></strong></marquee> </i>

            <i style="font-size: 20px;float:right;  ">客服热线&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;123456&nbsp;&nbsp;&nbsp;123456789</i>
        </b>
        </div>
    </div>
    <br/> <br/> <br/> <br/>
    <div>
        <span>
      <img src="" style="height: 100px;width: 100px;border-radius: 50%" id="image"/>
        </span>
        <h2 style="color:#e420d4;float: right;">
            <span id="sp_time">时间</span>&nbsp;&nbsp;
            <span id="sp_time2">欢迎你！</span>

        </h2>
    </div>
    <h1></h1>
    <div style="margin-top: 1%;" id="di">

        <div class="row">
            <div class="col-md-2">
                <div class="text-center ">
                    <p>
                        <a class="btn btn-block btn-info btn-lg text-center length" id="accountInfo" title="个人信息">
                            <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
                            <br/><i style="font-size: 10px;"></i></a>

                        <a class="btn btn-block btn-default btn-lg text-center length" id="withdrawal" title="取款"><span
                                class="glyphicon glyphicon-minus" aria-hidden="true"></span><br/><i
                                style="font-size: 10px;"></i></a>

                        <a class="btn btn-block btn-default btn-lg text-center length" id="deposit" title="存款 "><span
                                class="glyphicon glyphicon-plus" aria-hidden="true"></span><br/><i
                                style="font-size: 10px;"></i></a>

                        <a class="btn btn-block btn-warning btn-lg text-center length" id="transfer_accounts"
                           title="转账">
                            <span class="glyphicon glyphicon-zoom-out" aria-hidden="true"></span>
                            <br/><i style="font-size: 10px;"></i></a>

                        <a class="btn btn-block btn-info btn-lg text-center length" id="select_bakabce" title="查询余额">
                            <span class="glyphicon glyphicon-yen" aria-hidden="true"></span>
                            <br/><i style="font-size: 10px;"></i>
                        </a>
                    <a class="btn btn-block btn-info btn-lg text-center length" id="select_log" title="查询明细"> <span
                            class="glyphicon glyphicon-time" aria-hidden="true"></span> <br/><i
                            style="font-size: 10px;"></i></a>
                    <a class="btn btn-block btn-danger btn-lg text-center length" id="update_pass" title="修改密码 "><span
                            class="glyphicon glyphicon-wrench" aria-hidden="true"></span><br/><i
                            style="font-size: 10px;"></i>
                    </a>
                    <a class="btn btn-block btn-danger btn-lg text-center length" id="exit" title="退出">
                        <span class="glyphicon glyphicon-off" aria-hidden="true"></span><br/>
                        <i style="font-size: 10px;"></i>
                    </a>
                    </p>
                </div>
            </div>


            <div class="col-md-9">

                <h1 class="text-center" id="business" style="color: #e420d4;"><i id="i">转账</i></h1>
                <br/>
                <div id="module">
                    <div class="text-center " style="width: 400px;margin-left: 28%;">
                        <div class="input-group">
                            <input type="text" class="form-control input-lg text-center" id="inName" name="in_name"
                                   maxlength="20" placeholder="请输入转账的对方账户">
                            <div class="input-group-addon ">
                                <span class="glyphicon glyphicon-user" aria-hidden="true" id="isInName"></span>
                            </div>
                        </div>

                        <div class="input-group ">
                            <input type="text" class="form-control input-lg text-center" name="balabce" id="balabce"
                                   maxlength="10" placeholder="请输入要转账的金额">
                            <div class="input-group-addon "><span class="glyphicon glyphicon-yen"
                                                                  aria-hidden="true"></span></div>
                        </div>

                        <div class="input-group l">
                            <button type="submit" class="btn btn-block btn-info btn-lg text-center" style="width: 540%;"
                                    id="btn_transfer_accounts">转账
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="${pageContext.request.contextPath }/staticfile/js/jquery.js" type="text/javascript"
        charset="utf-8"></script>
<script src="https://www.xianliao.me/embed.js" type="text/javascript" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/staticfile/js/bootstrap.js" type="text/javascript"
        charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/npm/live2d-widget@3.0.4/lib/L2Dwidget.min.js"></script>
<script src="${pageContext.request.contextPath }/layui/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/layui/layui.all.js" charset="utf-8"></script>

<script type="text/javascript">
    function delayer() {
        window.location.href = "${pageContext.request.contextPath }/login";
    }

    $(function () {

        $.ajax({
            url: "${pageContext.request.contextPath}/affiche",
            type: 'post', //HTTP请求类型
            dataType:'json',
            contentType : 'application/json;charset=utf-8',
            success: function (data) {
                console.log(data);
                $.each(data.list, function(i, item) {
                    $("#affiche").html("<i>"+item.affiche_content+"</i>");
                })
                $("#image").attr('src',data.image);
            },
            error: function () {
                layer.msg("请稍后重试...!!", {icon: 6});
                return false;
            }

        })

        /*---------------------------查询看个人信息----strat--------*/

        $("#accountInfo").click(function () {
            $.ajax({
                url: "${pageContext.request.contextPath}/user/accountInfo",
                type: 'post', //HTTP请求类型
                dataType: 'json', //服务器返回json格式数据
                success: function (data) {
                    if (data=="500"){
                        layer.msg("成功返回的系统繁忙...请稍后重试...", {icon: 6});
                        return false;
                    }
                    $("#business").html("<i>个人信息</i>");
                        $("#module").html(
                            '<div  style="margin-left: 28%;color: #1abc9c;">'+
                            '<div class="layui-form-item">\n' +
                            '        <div class="layui-input-inline uploadHeadImage">\n' +
                            '            <div class="layui-upload-drag" id="headImg" style="background-color: none;">\n' +
                            '                <i class="layui-icon"></i>\n' +
                            '                <p>点击上传图片</p>\n' +
                            '            </div>\n' +
                            '        </div>\n' +
                            '        <div class="layui-input-inline">\n' +
                            '            <div class="layui-upload-list" style="margin: 2px 0;">\n' +
                            '                <img class="layui-upload-img headImage" src="" id="demo1" style="width: 129.2px;height: 129.3px;border-radius: 50%">\n' +
                            '                <p id="demoText"></p>\n' +
                            '            </div>\n' +
                            '        </div>\n' +
                            '    </div>'+
                            '<h2>用户名:&nbsp;'+ data.accountName+'</h2><br/>' +
                            '<h2>性别：&nbsp;'+

                            ' <label><input type="radio" id="man" value="男" class="accountInfoSex"/>&nbsp; 男 &nbsp;&nbsp;&nbsp; </label> ' +
                            ' <label><input type="radio" id="woman" value="女"  class="accountInfoSex"/>&nbsp; 女&nbsp;&nbsp;&nbsp; </label> ' +
                            ' <label><input type="radio" id="noSex" value="保密" class="accountInfoSex" />&nbsp; 保密 </label> ' +

                            '</h2><br/>' +

                            '<h2>邮箱：<input type="text" id="hiddenEmail" style="width: 56%;background: none;border-width: 1px;border-style: solid;"/>'+'</h2><br/>' +

                            '<h2>号码：<input type="text" id="phoneNumber" style="width: 56%;background: none;border-width: 1px;border-style: solid;"/>'+'</h2><br/>' +
                            /*data.hiddenAccountInfoBirthday*/
                            '<h2>生日：<div class="layui-inline">' +
                            '<input type="text" class="layui-input" id="test1" style="width: 95.5%;background: none;border-style: solid;">' +
                            '</div></h2></br>' +
                            '<h2><a href="javascript:;" class="layui-btn" id="updateBtn">更新</a></h2>'+
                            '</div>'
                        );
                        $("#hiddenEmail").val(data.hiddenEmail);
                        $("#test1").val(data.hiddenAccountInfoBirthday);
                        $("#phoneNumber").val(data.phoneNumber);

                    $("#demo1").attr('src',data.accountInfoImage);
                        /*-----------修改头像-start---------*/
                    layui.use(["jquery", "upload", "form", "layer", "element"], function () {
                        var $ = layui.$,
                            element = layui.element,
                            layer = layui.layer,
                            upload = layui.upload,
                            form = layui.form;
                        //拖拽上传
                        var uploadInst = upload.render({
                            elem: '#headImg'
                            , url: '${pageContext.request.contextPath }/user/updateAccountInfoImage'
                            , size: 50000
                            , before: function (obj) {
                                //预读本地文件示例，不支持ie8
                                obj.preview(function (index, file, result) {
                                    $('#demo1').attr('src', result); //图片链接（base64）
                                });
                            }
                            , done: function (res) {
                                //如果上传失败
                                if (res.code > 0) {
                                    return layer.msg('上传失败');
                                }
                                //上传成功
                                //打印后台传回的地址: 把地址放入一个隐藏的input中, 和表单一起提交到后台, 此处略..
                                console.log(res.data.src);
                                window.parent.uploadHeadImage(res.data.src);
                                var demoText = $('#demoText');
                                layer.msg('头像上传成功！', {icon: 6,shift: 6});
                            }
                            , error: function () {
                                //演示失败状态，并实现重传
                                var demoText = $('#demoText');
                                layer.msg('头像上传失败！稍等重试...', {icon: 6,shift: 6});
                                demoText.find('.demo-reload').on('click', function () {
                                    uploadInst.upload();
                                });
                            }
                        });
                        element.init();
                    });
                    $("#image").attr('src',data.accountInfoImage);

                        /*------------修改头像end------*/

                        $("#man").click(function () {
                            var checked = true;
                            $("#woman").attr({
                                checked:false
                            });

                            $("#noSex").attr({
                                checked:false
                            });
                            $.ajax({
                                url: "${pageContext.request.contextPath}/user/updateAccountInfoSex",
                                type: 'post', //HTTP请求类型
                                data:{
                                    accountInfoSex:$("#man").val()

                                },
                                success: function (data) {
                                    console.log(data)
                                    if (data=="200"){
                                        layer.msg("更新成功...",{icon:6});
                                    }
                                    if (data=="500"){
                                        layer.msg("更新失败...",{icon:5});
                                    }
                                }, error: function () {
                                    layer.msg("系统繁忙...请稍后重试...", {icon: 5});
                                    return false;
                                }
                            })
                        })

                    $("#woman").click(function () {
                        var checked = true;
                        $("#man").attr({
                            checked:false
                        });

                        $("#noSex").attr({
                            checked:false
                        });
                        $.ajax({
                            url: "${pageContext.request.contextPath}/user/updateAccountInfoSex",
                            type: 'post', //HTTP请求类型
                            data:{
                                accountInfoSex:$("#woman").val()

                            },
                            success: function (data) {
                                console.log(data)
                                if (data=="200"){
                                    layer.msg("更新成功...",{icon:6});
                                }
                                if (data=="500"){
                                    layer.msg("更新失败...",{icon:5});
                                }
                            }, error: function () {
                                layer.msg("系统繁忙...请稍后重试...", {icon: 5});
                                return false;
                            }
                        })
                    })

                    $("#noSex").click(function () {
                        var checked = true;
                        $("#man").attr({
                            checked:false
                        });

                        $("#woman").attr({
                            checked:false
                        });

                        $.ajax({
                            url: "${pageContext.request.contextPath}/user/updateAccountInfoSex",
                            type: 'post', //HTTP请求类型
                            data:{
                                accountInfoSex:$("#noSex").val()
                            },
                            success: function (data) {
                                console.log(data)
                                if (data=="200"){
                                    layer.msg("更新成功...",{icon:6});
                                }
                                if (data=="500"){
                                    layer.msg("更新失败...",{icon:5});
                                }
                            }, error: function () {
                                layer.msg("系统繁忙...请稍后重试...", {icon: 5});
                                return false;
                            }
                        })
                    })

                        var checked = true;
                        if(true == checked){
                            if (data.man=="300"){
                                $("#man").attr({
                                    checked:"checked"
                                });
                            }
                            if (data.woman=="380"){
                                $("#woman").attr({
                                    checked:"checked"
                                });
                            }

                            if (data.noSex=="404"){
                                $("#noSex").attr({
                                    checked:"checked"
                                });
                            }
                        }


                        
                        layui.use('laydate', function(){
                        var laydate = layui.laydate;
                        //执行一个laydate实例
                        laydate.render({
                            elem: '#test1' //指定元素
                        });

                        $("#updateBtn").click(function () {
                            if($("#phoneNumber").val()==''){
                                layer.msg('手机不能为空哦！', {icon: 6,shift: 6});
                                return false;
                            }

                            if($("#hiddenEmail").val()==''){
                                layer.msg('邮箱号码不能为空哦！', {icon: 6,shift: 6});
                                return false;
                            }

                            if ($("#test1").val()==''){
                                layer.msg("填生日有惊喜哦~",{icon:6});
                                return false;
                            }
                            if ($("#phoneNumber").val()!=''&&$("#hiddenEmail").val()!=''&&$("#test1").val()!='') {
                                var pattern = /^1[34578]\d{9}$/;
                                if (!pattern.test($("#phoneNumber").val())) {
                                    console.log("手机号码格式不正确，请重新填写.")
                                    layer.msg('手机号码格式不正确，请重新填写.', {icon: 6});
                                    return false;
                                }
                                var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
                                if (!reg.test($("#hiddenEmail").val())) {
                                    console.log("邮箱格式不正确，请重新填写.")
                                    layer.msg('邮箱格式不正确，请重新填写.', {icon: 6});
                                    return false;
                                }

                                console.log("生日--- "+$("#test1").val())
                                $.ajax({
                                    url: "${pageContext.request.contextPath}/user/updateAccountInfoBirthday",
                                    type: 'post', //HTTP请求类型
                                    data:{
                                        accountInfoBirthday:$("#test1").val(),
                                        hiddenEmail:$("#hiddenEmail").val(),
                                        phoneNumber:$("#phoneNumber").val()
                                    },
                                    success: function (data) {
                                        console.log(data)
                                        if (data=="200"){
                                            layer.msg("更新成功...",{icon:6});
                                        }
                                        if (data=="500"){
                                            layer.msg("更新失败...",{icon:5});
                                        }
                                    }, error: function () {
                                        layer.msg("系统繁忙...请稍后重试...", {icon: 5,shift: 6});
                                        return false;
                                    }
                                })
                            }

                        })

                    });

                },
                error: function (data) {
                    console.log(data)
                    layer.msg("系统繁忙...请稍后重试...", {icon: 6});
                }

            })

        })

        /*--------时间选择框----------*/

        /*---------------------------查询看个人信息--end-------------*/

        /* ****************************异步修改密码**************************** */
        $("#update_pass").click(function () {
            $("#business").html("<i>修改密码</i>");
            $("#module").html('<div class="text-center " style="width: 400px;margin-left: 28%;">' +
                '<div class="input-group ">' +
                '<input type="password" class="form-control input-lg text-center" maxlength="30" name="balabce" id="pass" placeholder="请输入旧密码">' +
                '<div class="input-group-addon ">' +
                '<span class="glyphicon glyphicon-lock" aria-hidden="true" id="image">' +
                '</span>' +
                '</div>' +
                '</div>' +
                '<div class="input-group ">' +
                '<input type="password" class="form-control input-lg text-center" name="balabce" id="new_pass" maxlength="30" placeholder="请输入新密码">' +
                '<div class="input-group-addon ">' +
                '<span class="glyphicon glyphicon-lock" aria-hidden="true"id="npass">' +
                '</span>' +
                '</div>' +
                '</div>' +
                '<div class="input-group "><input type="password" class="form-control input-lg text-center" name="balabce" id="again_new_pass" maxlength="30" placeholder="再次输入新密码">' +
                '<div class="input-group-addon ">' +
                '<span class="glyphicon glyphicon-lock" aria-hidden="true" id="anpass">' +
                '</span>' +
                '</div>' +
                '</div>' +
                '<div class="input-group l">' +
                '<button type="submit" class="btn btn-block btn-info btn-lg text-center" style="width: 360%;" id="btn_update_pass">' +
                '修改密码' +
                '</button>' +
                '</div>' +
                '</div>'
            );

            $("#btn_update_pass").click("btn_update_pass", function () {
                if ($("#pass").val() == '') {
                    layer.msg('请输入旧密码', {icon: 5});
                    return false;
                }

                if ($("#new_pass").val() == '') {
                    layer.msg('请输入新密码', {icon: 5});
                    return false;
                }

                if ($("#again_new_pass").val() == '') {
                    layer.msg('请再次输入新密码', {icon: 5});
                    return false;
                }

                if ($("#again_new_pass").val() != '' && $("#new_pass").val() != '') {
                    if ($("#again_new_pass").val()!=$("#new_pass").val() != '') {
                        layer.msg('两次输入的密码不一致', {icon: 5});
                        return false;
                    }
                }

                if ($("#pass").val() != ''&&$("#again_new_pass").val() != ''&&$("#new_pass").val() != '') {
                    $.ajax({
                        url: "${pageContext.request.contextPath}/user/updatePassword",
                        type: 'post', //HTTP请求类型
                        data: {
                            newPass: $("#new_pass").val(),
                            pass:$("#pass").val()
                        },
                        success: function (data) {
                            console.log(data);
                            if (data.statusCode=="200") {
                                layer.msg("密码修改成功..2秒后..跳转到登录页面", {icon: 1});
                                setTimeout(function(){//两秒后跳转
                                    window.location.href = "${pageContext.request.contextPath}/"; //PC网页式跳转
                                },2000);

                            }else if (data.statusCode=="100") {
                                layer.msg("旧密码不正确....", {icon: 5});
                            }
                        },
                        error: function () {
                            layer.msg("请稍后重试...!!", {icon: 6});
                            return false;
                        }

                    })
                }


            })

        })

        /* ****************************异步密码结束**************************** */


        /* ****************************异步存款**************************** */
        $("#deposit").click(function () {
            $("#msg").html("");
            $("#business").html("<i>请输入你要存款余额</i><br/>");
            var reg = /^[0-9]*[1-9][0-9]*$/;
            $("#module").html('<div class="text-center " style="width: 400px;margin-left: 28%;"><div class="input-group "><input type="text" maxlength="5" class="form-control input-lg text-center" name="balabce" id="balabce" placeholder="请输入要存款金额" ><div class="input-group-addon "><span class="glyphicon glyphicon-yen" aria-hidden="true"></span></div></div><div class="input-group l"><button type="submit" class="btn btn-block btn-info btn-lg text-center" style="width: 540%;" id="btnDeposit">存款</button></div></div>');

            /*  提交 方法*/
            $("#btnDeposit").click("btnWithdrawal", function () {

                if ($("#balabce").val()==''){
                    layer.msg('请输入存款金额', {icon: 6});
                    return false;
                }

                var reg=/^[0-9]*$/;
                if (!reg.test($("#balabce").val())){
                    layer.msg('输入的金额错误...', {icon: 6});
                    return false;
                }

                //如果正确那就发送异步请求
                if ($("#balabce").val()!=''){

                   $.ajax({
                        url: "${pageContext.request.contextPath}/user/in",
                        type: 'post', //HTTP请求类型
                        data: {
                            balabce: $("#balabce").val(),
                        },
                        success: function (data) {
                            if (data == "200") {
                                console.log(data);
                                layer.msg('存款成功', {icon: 6});
                            }else {
                                layer.msg('存款失败', {icon: 5});
                            }
                        },
                        error: function () {
                            layer.msg('系统繁忙!稍后重试........', {icon: 6});
                        }
                    })
            }
            })

        })


        /* ****************************异步存款结束**************************** */


        /* ****************************异步取款**************************** */
        $("#withdrawal").click(function () {
            $("#msg").html("");
            $("#business").html("<i>请输入你要取款余额</i><br/>");
            var reg = /^[0-9]*[1-9][0-9]*$/;
            $("#module").html('<div class="text-center " style="width: 400px;margin-left: 28%;"><div class="input-group "><input type="text" maxlength="5" class="form-control input-lg text-center" name="balabce" id="balabce" placeholder="请输入要取款金额" ><div class="input-group-addon "><span class="glyphicon glyphicon-yen" aria-hidden="true"></span></div></div><div class="input-group l"><button type="submit" class="btn btn-block btn-info btn-lg text-center" style="width: 540%;" id="btn_withdrawal">取款</button></div></div>');


            /*  提交 方法*/
            $("#btn_withdrawal").click( function () {

                if ($("#balabce").val()==''){
                    layer.msg('请输入取款金额', {icon: 6});
                    return false;
                }

                var reg=/^[0-9]*$/;
                if (!reg.test($("#balabce").val())){
                    layer.msg('输入的金额错误...', {icon: 6});
                    return false;
                }


                //如果正确那就发送异步请求
                if ($("#balabce").val()!=''){
                    $.ajax({
                        url: "${pageContext.request.contextPath}/user/out",
                        type: 'post', //HTTP请求类型
                        data: {
                            balabce: $("#balabce").val(),
                            out_name: "${name}",
                            ip: "${ip}",
                        },
                        success: function (data) {
                            $("#msg").html("");
                            if (data == "200") {
                                console.log(data);
                                layer.msg('取款成功.....', {icon: 6});
                            } else if (data=="100") {
                                layer.msg('余额不足.....', {icon: 5});
                            }else {
                                layer.msg('取款失败.....', {icon: 2});
                            }

                        },
                        error: function () {
                            layer.msg('系统繁忙!稍后重试........', {icon: 6});
                        }
                    })
                }
            })

        })
        /* ****************************异步取款结束**************************** */


        /* ****************************异步查询用户日志***queryAccountLog***分页********************** */
        $("#select_log").click(function () {
            $("#business").html("<i>操作记录</i>");
            $("#module").html('<table class="layui-hide"  id="demo" lay-filter="test"></table>');
            layui.use('table', function(){
                var table = layui.table; //表格
                //第一个实例
                table.render({
                    elem: '#demo'
                    ,height: 500
                    ,url: '${pageContext.request.contextPath}/user/queryAccountLog' //数据接口
                    ,page: true //开启分页
                    ,title: '操作记录'
                    //,limits:[10, 20, 30]    下拉框显示条数
                    ,toolbar: '#toolbarDemo' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
                    ,totalRow: true //开启合计行
                    //,id:'noticeid'
                    ,cols: [[ //表头
                        {type:'numbers'}
                        //,{field: 'noticeid', title: 'ID', width:50, sort: true, fixed: 'left',}
                        ,{field: 'logIp', title: 'IP地址'}
                        ,{field: 'logTime', title: '执行时间', sort: true }
                        ,{field: 'logContent', title: '类型'}//, sort: true
                        ,{field: 'accountName', title: '操作人'}
                    ]]
                });

        });

        })

        /* ****************************异步查询用户日志-结束**************************** */


        /* ****************************异步用户退出**************************** */
        $("#exit").click(function () {
            $.ajax({
                //${pageContext.request.contextPath}
                url: "${pageContext.request.contextPath}/user/exit",
                //dataType: 'json', //服务器返回json格式数据
                type: 'post', //HTTP请求类型
                data: {},
                success: function (data) {
                    console.log(data);
                    if (data) {
                        $("#module").html("");
                        layer.msg('退出成功........', {icon: 6});
                        window.location.href = "${pageContext.request.contextPath}/";
                    }
                },
                error: function () {
                    $("#module").html("");
                    layer.msg('退出成功........', {icon: 6});
                    window.location.href = "${pageContext.request.contextPath}/";
                }

            });

        })

        /* ****************************异步用户退出--结束**************************** */


        /* ****************************异步用户查询-余额-开始**************************** */
        $("#select_bakabce").click(function () {
            $("#msg").html("");
            console.log("${accountName}");
            $.ajax({
                url: "${pageContext.request.contextPath}/user/getAccountBalabce",
                dataType: 'json', //服务器返回json格式数据
                type: 'post', //HTTP请求类型
                contentType: "application/json;charset=utf-8",

                success: function (data) {
                    console.log(data + "--剩下余额");
                    if (data != null) {
                        $("#business").html("你的余额如下");
                        $("#module").html("<p class='text-center' style='color: #0dbc8a;font-size: 70px;margin-top: 6%;'>" + data.accountBalabce + "&nbsp;&nbsp;￥" + "</p>");
                    }
                },
                error: function () {
                    layer.msg('系统繁忙!稍后重试........', {icon: 6,shift:6});
                }
            });

        })

        /* ****************************异步用户查询-余额--结束**************************** */


        /* ****************************异步转账-*-开始**************************** */
        var $btn_transfer_accounts = $("#btn_transfer_accounts");
        var $balabce = $("#balabce").val();
        var $inName = $("#inName").val();

        $("#transfer_accounts").click(function () {
            window.location.reload();
        });

        //开始转账 btn_transfer_accounts
        $("#btn_transfer_accounts").click(function () {

            if ($("#inName").val()==''){
                layer.msg('请输入要转账的账户.....', {icon: 6});
                return false;
            }

            if ($("#balabce").val()==''){
                layer.msg('请输入转账金额.....', {icon: 6});
                return false;
            }

            var reg=/^[0-9]*$/;
            if (!reg.test($("#balabce").val())){
                layer.msg('输入的金额错误...', {icon: 6});
                return false;
            }

            if ( $("#balabce").val() !=  '' &&  $("#inName").val()!= '') {
                $.ajax({
                    url: "${pageContext.request.contextPath}/user/transferAccounts",
                    type: 'post', //HTTP请求类型
                    data: {
                        balabce: $("#balabce").val(),
                        inName: $("#inName").val()
                    },
                    success: function (data) {
                        console.log(data)

                        if (data=="100"){
                            layer.msg('余额不足........', {icon: 5});
                        }

                        if (data=="200"){
                            layer.msg('转账成功........', {icon: 6});
                        }

                        if (data=="404"){
                            layer.msg('收款账户不否存在........', {icon: 2});
                        }

                        if (data=="303"){
                            layer.msg('不能向自己转账哦........', {icon: 6});
                        }

                        if (data=="500"){
                            layer.msg('转账失败........', {icon: 5});
                        }

                    },
                    error: function () {
                        layer.msg('系统繁忙!稍后重试........', {icon: 6});
                    }
                })

            }


        })
        /* ****************************异步转账--end**************************** */




        /* ****************************时间**************************** */
        function showTime() {
            var $time = $("#sp_time");
            var $time2 = $("#sp_time2");

            function getNow(s) {
                return s < 10 ? '0' + s : s;
            }

            var myDate = new Date();
            // 			var year = myDate.getFullYear(); //获取当前年
            // 			var month = myDate.getMonth() + 1; //获取当前月
            // 			var date = myDate.getDate(); //获取当前日	year + '-' + getNow(month) + "-" + getNow(date) + " " +

            var h = myDate.getHours(); //获取当前小时数(0-23)
            var m = myDate.getMinutes(); //获取当前分钟数(0-59)
            var s = myDate.getSeconds();
            var now = getNow(h) + ':' + getNow(m) + ":" + getNow(s);

            $time.html("&nbsp;&nbsp;${accountName}&nbsp;&nbsp;" + now + "&nbsp;&nbsp;");
            /**
             * 子时23～1点， 丑时1～3点，寅时3～5点，卯时5～7点，辰时7～9点，巳时9～11点
             *，午时11～13点，未时13～15点，申时15～17点，酉时17～19点，戌时19～21点，亥时21～23点。
             */

            if (h < 3) {
                $time2.html("丑时好！")
            } else if (h < 7) {
                $time2.html("卯时好！")
            } else if (h < 9) {
                $time2.html("辰时好！")
            } else if (h < 11) {
                $time2.html("巳时好！")
            } else if (h < 13) {
                $time2.html("午时好！")
            } else if (h < 15) {
                $time2.html("未时好！")
            } else if (h < 17) {
                $time2.html("申时好！")
            } else if (h < 19) {
                $time2.html("酉时好！")
            } else if (h < 21) {
                $time2.html("戌时好！")
            } else if (h < 23) {
                $time2.html("亥时好！")
            } else if (h < 1) {
                $time2.html("子时好！")
            }
        }
        showTime();
        setInterval(showTime, 1000);
        /* ****************************--时间--end**************************** */
    })
</script>

<script src="${pageContext.request.contextPath }/staticfile/js/younger.js"></script>
<script type="text/javascript">
    L2Dwidget.init();
</script>
</html>
